import React, { Component, ComponentClass } from 'react';
import Taro from '@tarojs/taro';
import {Block, View, Text} from '@tarojs/components';
import {connect} from 'react-redux';
import './mealShow.scss';

type PageOwnProps = {};
type PageState = {
	mealList: Array
};

@connect(({selectDate}) => ({
  selectDate,
}), () => ({}))

class MealShow extends Component{
	state: PageState = {
		mealList: []
	};

	async UNSAFE_componentWillMount() {
		const { goodId, meals } = this.props;
		console.log("goodId : ", goodId);
		console.log("meals : ", meals);
		const mealList = [
			{
				latitude: "28.726795196533203",
				longitude: "115.91416931152344",
				name: "77.77元情侣双人夜场票，可免費携带2名1.2米以下儿童",
				phone: "13576952045",
				label: ["需预约", "随时退"]
			},
			{
				latitude: "28.799734115600586",
				longitude: "115.74407958984375",
				name: "59元单人特惠通玩票，可免費携带1名1.2米以下儿童",
				phone: "13576952045",
				label: ["需预约", "随时退"]
			}
		];
		this.setState({ mealList });
	}

	viewStore = async () => {
		// const { goodId } = this.props;
		const goodId = 30965;
		Taro.navigateTo({url: '/common/limited/list?goodsId=' + goodId})
	}

	render() {
		return (
			<Block>
				<View className="at-row meal-list">
					<View className="at-col at-col at-col--wrap ml-left">
						<View className="name">
							<Text>77.77元情侣双人夜场票，可免費携带2名1.2米以下儿童</Text>
						</View>
						<View className="store">
							<Text className="label">需预约</Text>
							<Text className="view-store" onClick={this.viewStore}>
								查看适用门店
								<Text className="arrow"></Text>
							</Text>
						</View>
					</View>
					<View className="at-col-1 ml-right">x1</View>
				</View>
				<View className="at-row meal-list">
					<View className="at-col at-col at-col--wrap ml-left">
						<View className="name">
							<Text>77.77元情侣双人夜场票，可免費携带2名1.2米以下儿童</Text>
						</View>
						<View className="store">
							<Text className="label">需预约</Text>
							<Text className="view-store">
								查看适用门店
								<Text className="arrow"></Text>
							</Text>
						</View>
					</View>
					<View className="at-col-1 ml-right">x1</View>
				</View>
			</Block>
		)
	}
}

export default MealShow as ComponentClass<PageOwnProps, PageState>;
